<?php

namespace common\models\wechat;

use Yii;

/**
 * This is the model class for table "wechat_video_reply".
 *
 * @property string $id
 * @property string $rid
 * @property string $title
 * @property string $description
 * @property string $mediaid
 * @property integer $createtime
 */
class WechatVideoReply extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'wechat_video_reply';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['rid', 'title', 'description', 'mediaid', 'createtime'], 'required'],
            [['rid', 'createtime'], 'integer'],
            [['title'], 'string', 'max' => 50],
            [['description', 'mediaid'], 'string', 'max' => 255],
            ['file', 'file', 'extensions' => ['mp4'], 'maxSize' => 1024 * 1024 * 1024]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'rid' => '规则',
            'title' => '标题',
            'description' => '简介',
            'mediaid' => 'Mediaid',
            'createtime' => '创建时间',
            'file' => '视频'
        ];
    }

    public function getRule()
    {
        return $this->hasOne(WechatReplyRule::className(),['id'=>'rid']);
    }


    public function getkeyword()
    {
        return $this->hasOne(WechatReplyKeyword::className(),['rid'=>'rid']);
    }
}
